package com.sl.au.controller;

import java.util.HashMap;
import java.util.Map;

import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.sl.au.service.AttachmentService;
import com.sl.au.service.SMSService;

/*
 *  主动售后
 */

@RestController
@RequestMapping(value = "/ui/demo")
public class DemoController extends BaseController {

	
	@Autowired
	AttachmentService aService;
	@Autowired
	SMSService smsService;
	
	@RequestMapping(value = "doc", method = RequestMethod.GET)
	Map<String, Object> exportWord() {
		Map<String, Object> map = new HashMap<>();

		int code = -1;
		//DocService.TextExportDoc("test", "LOVE U 彼岸花！");
		code = 0;
		map.put("code", code);
		return map;
	}
	@RequestMapping(value = "sms", method = RequestMethod.GET)
	Map<String, Object> SMS() {
		Map<String, Object> map = new HashMap<>();

		int code = -1;
		smsService.sendSMS2("大家好我是Neil!收到请回复，谢谢！","['15823929813']");
		code = 0;
		map.put("code", code);	
		return map;
	}
	/*@RequestMapping(value = "docdata", method = RequestMethod.GET)
	public ResponseEntity<Resource> exportWordData() throws UnsupportedEncodingException {
		Map<String, String> data = new HashMap<>();
		data.put("projectName", "中冶桃花源");
		String filename = DocService.replace("报价单模板.docx", data, "报价单.docx");
		Resource file=null;
		if(null!=filename) file=aService.loadAsResource(filename);
		return ResponseEntity.ok().header(HttpHeaders.CONTENT_DISPOSITION,
				"attachment; charset=UTF-8;filename=\"" + java.net.URLEncoder.encode("报价单.docx", "UTF-8") + "\"")
				.body(file);
	}*/
}
